package com.poker.repository;

import com.poker.entity.Activity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface ActivityRepository extends JpaRepository<Activity,String>, JpaSpecificationExecutor<Activity> {

    @Query(value = "select * from activity where DATEDIFF(NOW(),begin_time)>0 and DATEDIFF(NOW(),end_time)<0", nativeQuery = true)
    List<Activity> findActIng();

    @Query(value = "select * from activity where DATEDIFF(NOW(),end_time)>0", nativeQuery = true)
    List<Activity> findActEnd();

    @Query(value = "select * from activity where DATEDIFF(NOW(),begin_time)<0", nativeQuery = true)
    List<Activity> findActSign();

}
